//const controllers = require('../../controllers/controllerIndex.js').controller;
const app = getApp();
const controllers = app.controllers;
Page({
  data: {
    dataList:[],
    vipGoodsId:null,
  },
  onLoad: function (options) {
    if(options.vipGoodsId){
      this.data.vipGoodsId = options.vipGoodsId;
    }
    this.getList();
  },
  getList: function () {
    let searchKey = this.data.searchKey||"";
    let that = this;
    let d ={goodsName: searchKey,type:2};
    if(this.data.vipGoodsId){
      d.vipGoodsId = this.data.vipGoodsId;
    }
    d.pageNumber = 1;
    d.pageSize = 200;//先不做分页
    app.requestApi("/api/vip/vipDeductionRecord",d).then(data =>{
      that.setData({
        dataList:data.list||[]
      });
    });
  },
  openCard() {
    wx.navigateTo({
      url: '../OpenCard/OpenCard',
    })
  },
  
  searchInput: function (e) {//搜索输入框
    this.setData({
      searchKey:e.detail.value
    });
  },
  onSearch: function (e) {//搜索
    this.getList();
  }, 
  toUrl(e) {
    var d = e.currentTarget.dataset;
    let url = d.url;
    console.info(url);
    wx.navigateTo({
      url: url
    });
  },

})